package com.bdqn.bookshop.controller.admin;

import com.bdqn.bookshop.entity.Books;
import com.bdqn.bookshop.service.BooksService;
import com.bdqn.bookshop.utils.DataGridViewResult;
import com.bdqn.bookshop.utils.Result;
import com.bdqn.bookshop.vo.BooksVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : 罗若然[LUO_RUO_RAN]
 * @date : 2020-07-30 15:34
 **/
@RestController
@RequestMapping("/admin/books")
public class AdminBooksController {

    @Autowired
    private BooksService booksService;

    @RequestMapping("/booksList")
    public DataGridViewResult booksList(BooksVo booksVo){
        return booksService.booksList(booksVo);
    }

    @RequestMapping("/soldout")
    public Result soldoutById(Books books){
        return booksService.updateBookState(books);
    }

    @RequestMapping("/selectById")
    public Result selectById(Integer id){
        return booksService.selectById(id);
    }
}
